﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Maticsoft.DBUtility;
using GMS.Web.CommonPage;

public partial class DMWEB_Pages_Public_M_right : System.Web.UI.Page
{   
    ComOperate Op = new ComOperate();

    public static string user_list = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ShowCity();
        }
    }

    public void ShowCity()
    {
        HtmlTableCell hc = null;
        HtmlTableRow hr = null;
        string sty_left = "border-left-color:#6666ff;",
                sty_right = "border-right-color:#6666ff;",
                sty_top = "border-top-color:#6666ff;",
                sty_botton = "border-botton-color:#6666ff;",
                style = "";

        string sql = "", str = "", temp = "", s_right = "";
        string option_fgs = "";
        DataTable dt = null;


        sql = " select *from tab_city"; // order by id_index 需要根据当年的序号进行排序？
        dt = DbHelperSQL.DataTable(sql);
        option_fgs = "<option value = '-1'>--请选择--</option>";
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            option_fgs += "<option value='" + dt.Rows[i]["citycode"].ToString() + "'>" + dt.Rows[i]["cityname"].ToString() + "</option>";
        }




        //sql = " select yhbh,qxlook,qxmod,qxadd,qxdelete from tab_yhqxb where yhbh is not null ";
        //dt = DB.DataTable(sql);
        //user_list = "";
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    user_list += dt.Rows[i]["yhbh"].ToString() + "-"
        //                + (dt.Rows[i]["qxlook"].ToString().Equals("") ? "0" : dt.Rows[i]["qxlook"].ToString()) + "-"
        //                + (dt.Rows[i]["qxmod"].ToString().Equals("") ? "0" : dt.Rows[i]["qxmod"].ToString()) + "-"
        //                + (dt.Rows[i]["qxadd"].ToString().Equals("") ? "0" : dt.Rows[i]["qxadd"].ToString()) + "-"
        //                + (dt.Rows[i]["qxdelete"].ToString().Equals("") ? "0" : dt.Rows[i]["qxdelete"].ToString()) + ";";
        //}


        //sql = " select * from tab_fgs order by id_index ";
        //dt = DB.DataTable(sql);
        ////sty_right = sty_top + sty_left + sty_botton + sty_right;

        //#region====================表 头

        //hr = new HtmlTableRow();
        //style = sty_right;

        //hc = new HtmlTableCell();
        //hc.InnerText = "权限显示区：";
        //hc.Style.Value = "width:80px;font-weight:bold;" + style;
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerText = "[地区]";
        //hc.Style.Value = "width:60px;color:Red;" + style;
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerText = "[现有权限]";
        //hc.Style.Value = "width:60px;color:Red;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "&nbsp";
        //hc.Style.Value = "width:60px;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "&nbsp";
        //hc.Style.Value = "width:60px;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "&nbsp";
        //hc.Style.Value = "width:60px;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "&nbsp";
        //hc.Style.Value = "width:60px;" + style;
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "&nbsp";
        //hc.Style.Value = "width:400px;";
        //hr.Cells.Add(hc);

        //tab.Rows.Add(hr);
        //#endregion
        //#region==========================第一行
        //hr = new HtmlTableRow();
        //style = sty_right + sty_top;

        //hc = new HtmlTableCell();
        //hc.Style.Value = style;
        //hc.InnerHtml = "&nbsp";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.Style.Value = style;
        //hc.InnerHtml = "&nbsp";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "全选<input id='look_all' onclick='chkbyid(\"q_look\",this)' type='checkbox' />";
        //hc.Style.Value = style + "font-weight:bold;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "全选<input id='update_all' onclick='chkbyid(\"q_update\",this)' type='checkbox' />";
        //hc.Style.Value = style + "font-weight:bold;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "全选<input id='insert_all' onclick='chkbyid(\"q_insert\",this)' type='checkbox' />";
        //hc.Style.Value = style + "font-weight:bold;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "全选<input id='delete_all' onclick='chkbyid(\"q_delete\",this)' type='checkbox' />";
        //hc.Style.Value = style + "font-weight:bold;";
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.InnerHtml = "&nbsp";
        //hc.Style.Value = style;
        //hr.Cells.Add(hc);

        //hc = new HtmlTableCell();
        //hc.Style.Value = "font-weight:bold;" + sty_top;
        //hc.InnerHtml = "用户操作区：";
        //hr.Cells.Add(hc);

        //tab.Rows.Add(hr);
        //#endregion
        //for (int i = 0; i < dt.Rows.Count; i++)
        //{
        //    #region 添加基本控件
        //    hr = new HtmlTableRow();

        //    hc = new HtmlTableCell();
        //    hc.InnerText = Convert.ToString(i + 1);
        //    hc.Style.Value = style + "font-weight:bold;";
        //    hr.Cells.Add(hc);

        //    hc = new HtmlTableCell();
        //    hc.InnerText = dt.Rows[i]["fgsname"].ToString();
        //    hc.Style.Value = style + "font-weight:bold;";
        //    hr.Cells.Add(hc);

        //    hc = new HtmlTableCell();
        //    hc.InnerHtml = "查看<input id='q_look' name='q_look_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "'  type='checkbox' />";
        //    hc.Style.Value = style;
        //    hr.Cells.Add(hc);

        //    hc = new HtmlTableCell();
        //    hc.InnerHtml = "修改<input id='q_update' name='q_update_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' type='checkbox' />";
        //    hc.Style.Value = style;
        //    hr.Cells.Add(hc);

        //    hc = new HtmlTableCell();
        //    hc.InnerHtml = "插入<input id='q_insert' name='q_insert_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "'  type='checkbox' />";
        //    hc.Style.Value = style;
        //    hr.Cells.Add(hc);

        //    hc = new HtmlTableCell();
        //    hc.InnerHtml = "删除<input id='q_delete' name='q_delete_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' type='checkbox' />";
        //    hc.Style.Value = style;
        //    hr.Cells.Add(hc);

        //    hc = new HtmlTableCell();
        //    hc.InnerHtml = "全选<input type='checkbox' id='chk_all' onclick='chkbyname(this);' value='" + dt.Rows[i]["fgs_bdwbh"].ToString() + "'/>";
        //    hc.Style.Value = style + "font-weight:bold;";
        //    hr.Cells.Add(hc);
        //    #endregion

        //    if (i == 0)
        //    {
        //        hc = new HtmlTableCell();
        //        hc.Style.Value = sty_top + " vertical-align:top;";
        //        hc.RowSpan = dt.Rows.Count;

        //        sql = " select * from tab_usergroup order by createdate ";
        //        DataTable dt2 = DB.DataTable(sql);
        //        temp = "<option value='-1'>--请选择--</option>";
        //        for (int j = 0; j < dt2.Rows.Count; j++)
        //        {
        //            temp += "<option value=\"" + (dt2.Rows[j]["qx_look"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_look"].ToString()) + "-"
        //                + (dt2.Rows[j]["qx_update"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_update"].ToString()) + "-"
        //                + (dt2.Rows[j]["qx_insert"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_insert"].ToString()) + "-"
        //                + (dt2.Rows[j]["qx_delete"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_delete"].ToString())

        //                + "\">" + dt2.Rows[j]["groupname"].ToString() + "</option>";
        //        }

        //        hc.InnerHtml = "<div style='width:100%;height:100%;vertical-align:top;'>"
        //                        + "<div  id='div_style' title='设置用户组权限' onclick='divm();'>用户组权限管理</div>"
        //            //=======用户组权限管理

        //                        + "<div  id='div_group' class='div_style_con'>"
        //                        + "<table style='width:100%;'>"
        //                        + "<tr>"
        //                        + "<td style='width:70px'>用户组：</td><td style='width:100px'><select style='width:120px' onchange='groupchange(this,1);' id='select_group'>" + temp + "</select></td>"
        //                        + "<td style='width:60px'><input type='button' value='修 改' onclick='updategroup();' style='width:60px' class='buttonface'></td>"
        //                        + "<td><input type='button' value='删 除' onclick='deletegroup();' style='width:60px' class='buttonface'></td>"
        //                        + "</tr>"
        //                        + "<tr>"
        //                        + "<td>组名：</td><td><input type='text' id='txt_groupname' AutoComplete = 'off' style='width:110px' /></td>"
        //                        + "<td><input type='button' value='添 加' onclick='addgroup();' style='width:60px' class='buttonface'></td>"
        //                        + "<td></td>"
        //                        + "</tr>"
        //                        + ""
        //                        + "</table>"
        //                        + "</div>"

        //                        + "<div  id='div_style' title='用户管理' onclick='divm();'>用户管理</div>"

        //                        //=======用户权限管理
        //                        + "<div id='div_user' class='div_style_con'>"
        //            //添加用户
        //                        + "<div style='text-align:center;' onclick='changedivuser();' title='添加用户信息' id='div_style'>添加用户</div>"
        //                        + "<div  id='div_user_add' style='display:none' class='div_style_con2'>"


        //                        + "<table id='tab_user_add' style='width:100%'>"
        //                        + "<tr>"
        //                        + "<td style='width:50px'>用户ID：</td>"
        //                        + "<td style='width:120px'><input type='text' style='width:80px' AutoComplete='off' id='txt_userid2' /><input type='button' value='测试' onclick='testuserid();' style='width:30px' /></td>"
        //                        + "<td style='width:50px'>用户名：</td>"
        //                        + "<td><input type='text' style='width:80px' AutoComplete='off' id='txt_username' /></td>"
        //                        + "</tr>"
        //                        + "<tr>"
        //                        + "<td>本地网：</td>"
        //                        + "<td><select id='select_bdw' style='width:105px'>" + option_fgs + "</select></td>"
        //                        + "<td>密 码：</td>"
        //                        + "<td><span style='color:red'>000000</span></td>"
        //                        + "</tr>"
        //                        + "<tr>"
        //                        + "<td>用户组：</td>"
        //                        + "<td><select id='select_group2'  onchange='groupchange(this,11);'  style='width:105px'>" + temp + "</select></td>"
        //                        + "<td>角 色：</td>"
        //                        + "<td><select id='select_js' style='width:105px'><option value='-11'>--请选择--</option><option value='1'>分公司</option><option value='0'>省公司</option></select></td>"
        //                        + "</tr>"
        //                        + "<tr>"
        //                        + "<td colspan=2>BS锁定：<input type='checkbox' id='chk_bslock' /></td>"
        //                        + "<td colspan=2>CS管理员：<input type='checkbox' id='chk_csmg' /></td>"
        //                        + "</tr>"
        //                        + "<tr style='text-align:center'>"
        //                        + "<td colspan='4'>"
        //                        + "<input type='button' value='添 加' onclick='adduser();' class='buttonface' style='width:60px' />&nbsp&nbsp&nbsp<input type='button' value='清 空' class='buttonface' onclick='clearuserinfo();' style='width:60px' />"
        //                        + "</td>"
        //                        + "</tr>"
        //                        + "</table>"


        //                        + "</div>"
        //            //查询用户
        //                        + "<div style='text-align:center;' onclick='changedivuser();' title='查询用户权限' id='div_style'>查询用户权限</div>"
        //                        + "<div  id='div_user_look' class='div_style_con2'>"


        //                        + "<table id='tab_user_look' style='width:100%;'>"
        //                        + "<tr>"
        //                        + "<td style='width:50px'>用户ID：</td>"
        //                        + "<td style='width:120px'><input type='text' style='width:80px' id='txt_userid1' /><input type='button' value='>>>' onclick='selectuser();' style='width:30px' /></td>"
        //                        + "<td><input type='button' value='查 询' onclick='showuserrightbyid();' style='width:42px' class='buttonface'>"
        //                        + "&nbsp<input type='button' value='删 除' onclick='deleteuser();' style='width:42px' class='buttonface'>"
        //                        + "&nbsp<input type='button' value='用户信息'  style='width:65px' onclick='ModifyUserById();' class='buttonface'></td>"
        //                        + "</tr>"
        //                        + "</table>"


        //                        + "</div>"
        //                        + "</div>"



        //            + "</div>";
        //        hr.Cells.Add(hc);
        //    }
        //    tab.Rows.Add(hr);
        //}

    }


    //public void showfgs()
    //{
    //    HtmlTableCell hc = null;
    //    HtmlTableRow hr = null;
    //    string sty_left = "border-left-color:#6666ff;",
    //            sty_right = "border-right-color:#6666ff;",
    //            sty_top = "border-top-color:#6666ff;",
    //            sty_botton = "border-botton-color:#6666ff;",
    //            style = "";

    //    string sql = "", str = "", temp = "", s_right = "";
    //    string option_fgs = "";
    //    DataTable dt = null;


    //    sql = " select *from tab_fgs order by id_index ";
    //    dt = DB.DataTable(sql);
    //    option_fgs = "<option value = '-1'>--请选择--</option>";
    //    for (int i = 0; i < dt.Rows.Count; i++)
    //    {
    //        option_fgs += "<option value='" + dt.Rows[i]["fgs_bdwbh"].ToString() + "'>" + dt.Rows[i]["fgsname"].ToString() + "</option>";
    //    }




    //    sql = " select yhbh,qxlook,qxmod,qxadd,qxdelete from tab_yhqxb where yhbh is not null ";
    //    dt = DB.DataTable(sql);
    //    user_list = "";
    //    for (int i = 0; i < dt.Rows.Count; i++)
    //    {
    //        user_list += dt.Rows[i]["yhbh"].ToString() + "-"
    //                    + (dt.Rows[i]["qxlook"].ToString().Equals("") ? "0" : dt.Rows[i]["qxlook"].ToString()) + "-"
    //                    + (dt.Rows[i]["qxmod"].ToString().Equals("") ? "0" : dt.Rows[i]["qxmod"].ToString()) + "-"
    //                    + (dt.Rows[i]["qxadd"].ToString().Equals("") ? "0" : dt.Rows[i]["qxadd"].ToString()) + "-"
    //                    + (dt.Rows[i]["qxdelete"].ToString().Equals("") ? "0" : dt.Rows[i]["qxdelete"].ToString()) + ";";
    //    }


    //    sql = " select * from tab_fgs order by id_index ";
    //    dt = DB.DataTable(sql);
    //    //sty_right = sty_top + sty_left + sty_botton + sty_right;

    //    #region====================表 头

    //    hr = new HtmlTableRow();
    //    style = sty_right;

    //    hc = new HtmlTableCell();
    //    hc.InnerText = "权限显示区：";
    //    hc.Style.Value = "width:80px;font-weight:bold;" + style;
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerText = "[地区]";
    //    hc.Style.Value = "width:60px;color:Red;" + style;
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerText = "[现有权限]";
    //    hc.Style.Value = "width:60px;color:Red;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "&nbsp";
    //    hc.Style.Value = "width:60px;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "&nbsp";
    //    hc.Style.Value = "width:60px;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "&nbsp";
    //    hc.Style.Value = "width:60px;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "&nbsp";
    //    hc.Style.Value = "width:60px;" + style;
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "&nbsp";
    //    hc.Style.Value = "width:400px;";
    //    hr.Cells.Add(hc);

    //    tab.Rows.Add(hr);
    //    #endregion
    //    #region==========================第一行
    //    hr = new HtmlTableRow();
    //    style = sty_right + sty_top;

    //    hc = new HtmlTableCell();
    //    hc.Style.Value = style;
    //    hc.InnerHtml = "&nbsp";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.Style.Value = style;
    //    hc.InnerHtml = "&nbsp";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "全选<input id='look_all' onclick='chkbyid(\"q_look\",this)' type='checkbox' />";
    //    hc.Style.Value = style + "font-weight:bold;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "全选<input id='update_all' onclick='chkbyid(\"q_update\",this)' type='checkbox' />";
    //    hc.Style.Value = style + "font-weight:bold;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "全选<input id='insert_all' onclick='chkbyid(\"q_insert\",this)' type='checkbox' />";
    //    hc.Style.Value = style + "font-weight:bold;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "全选<input id='delete_all' onclick='chkbyid(\"q_delete\",this)' type='checkbox' />";
    //    hc.Style.Value = style + "font-weight:bold;";
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.InnerHtml = "&nbsp";
    //    hc.Style.Value = style;
    //    hr.Cells.Add(hc);

    //    hc = new HtmlTableCell();
    //    hc.Style.Value = "font-weight:bold;" + sty_top;
    //    hc.InnerHtml = "用户操作区：";
    //    hr.Cells.Add(hc);

    //    tab.Rows.Add(hr);
    //    #endregion
    //    for (int i = 0; i < dt.Rows.Count; i++)
    //    {
    //        #region 添加基本控件
    //        hr = new HtmlTableRow();

    //        hc = new HtmlTableCell();
    //        hc.InnerText = Convert.ToString(i + 1);
    //        hc.Style.Value = style + "font-weight:bold;";
    //        hr.Cells.Add(hc);

    //        hc = new HtmlTableCell();
    //        hc.InnerText = dt.Rows[i]["fgsname"].ToString();
    //        hc.Style.Value = style + "font-weight:bold;";
    //        hr.Cells.Add(hc);

    //        hc = new HtmlTableCell();
    //        hc.InnerHtml = "查看<input id='q_look' name='q_look_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "'  type='checkbox' />";
    //        hc.Style.Value = style;
    //        hr.Cells.Add(hc);

    //        hc = new HtmlTableCell();
    //        hc.InnerHtml = "修改<input id='q_update' name='q_update_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' type='checkbox' />";
    //        hc.Style.Value = style;
    //        hr.Cells.Add(hc);

    //        hc = new HtmlTableCell();
    //        hc.InnerHtml = "插入<input id='q_insert' name='q_insert_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "'  type='checkbox' />";
    //        hc.Style.Value = style;
    //        hr.Cells.Add(hc);

    //        hc = new HtmlTableCell();
    //        hc.InnerHtml = "删除<input id='q_delete' name='q_delete_" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' value = '" + dt.Rows[i]["fgs_bdwbh"].ToString() + "' type='checkbox' />";
    //        hc.Style.Value = style;
    //        hr.Cells.Add(hc);

    //        hc = new HtmlTableCell();
    //        hc.InnerHtml = "全选<input type='checkbox' id='chk_all' onclick='chkbyname(this);' value='" + dt.Rows[i]["fgs_bdwbh"].ToString() + "'/>";
    //        hc.Style.Value = style + "font-weight:bold;";
    //        hr.Cells.Add(hc);
    //        #endregion

    //        if (i == 0)
    //        {
    //            hc = new HtmlTableCell();
    //            hc.Style.Value = sty_top + " vertical-align:top;";
    //            hc.RowSpan = dt.Rows.Count;

    //            sql = " select * from tab_usergroup order by createdate ";
    //            DataTable dt2 = DB.DataTable(sql);
    //            temp = "<option value='-1'>--请选择--</option>";
    //            for (int j = 0; j < dt2.Rows.Count; j++)
    //            {
    //                temp += "<option value=\"" + (dt2.Rows[j]["qx_look"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_look"].ToString()) + "-"
    //                    + (dt2.Rows[j]["qx_update"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_update"].ToString()) + "-"
    //                    + (dt2.Rows[j]["qx_insert"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_insert"].ToString()) + "-"
    //                    + (dt2.Rows[j]["qx_delete"].ToString().Equals("") ? "0" : dt2.Rows[j]["qx_delete"].ToString())

    //                    + "\">" + dt2.Rows[j]["groupname"].ToString() + "</option>";
    //            }

    //            hc.InnerHtml = "<div style='width:100%;height:100%;vertical-align:top;'>"
    //                            + "<div  id='div_style' title='设置用户组权限' onclick='divm();'>用户组权限管理</div>"
    //                //=======用户组权限管理

    //                            + "<div  id='div_group' class='div_style_con'>"
    //                            + "<table style='width:100%;'>"
    //                            + "<tr>"
    //                            + "<td style='width:70px'>用户组：</td><td style='width:100px'><select style='width:120px' onchange='groupchange(this,1);' id='select_group'>" + temp + "</select></td>"
    //                            + "<td style='width:60px'><input type='button' value='修 改' onclick='updategroup();' style='width:60px' class='buttonface'></td>"
    //                            + "<td><input type='button' value='删 除' onclick='deletegroup();' style='width:60px' class='buttonface'></td>"
    //                            + "</tr>"
    //                            + "<tr>"
    //                            + "<td>组名：</td><td><input type='text' id='txt_groupname' AutoComplete = 'off' style='width:110px' /></td>"
    //                            + "<td><input type='button' value='添 加' onclick='addgroup();' style='width:60px' class='buttonface'></td>"
    //                            + "<td></td>"
    //                            + "</tr>"
    //                            + ""
    //                            + "</table>"
    //                            + "</div>"

    //                            + "<div  id='div_style' title='用户管理' onclick='divm();'>用户管理</div>"

    //                            //=======用户权限管理
    //                            + "<div id='div_user' class='div_style_con'>"
    //                //添加用户
    //                            + "<div style='text-align:center;' onclick='changedivuser();' title='添加用户信息' id='div_style'>添加用户</div>"
    //                            + "<div  id='div_user_add' style='display:none' class='div_style_con2'>"


    //                            + "<table id='tab_user_add' style='width:100%'>"
    //                            + "<tr>"
    //                            + "<td style='width:50px'>用户ID：</td>"
    //                            + "<td style='width:120px'><input type='text' style='width:80px' AutoComplete='off' id='txt_userid2' /><input type='button' value='测试' onclick='testuserid();' style='width:30px' /></td>"
    //                            + "<td style='width:50px'>用户名：</td>"
    //                            + "<td><input type='text' style='width:80px' AutoComplete='off' id='txt_username' /></td>"
    //                            + "</tr>"
    //                            + "<tr>"
    //                            + "<td>本地网：</td>"
    //                            + "<td><select id='select_bdw' style='width:105px'>" + option_fgs + "</select></td>"
    //                            + "<td>密 码：</td>"
    //                            + "<td><span style='color:red'>000000</span></td>"
    //                            + "</tr>"
    //                            + "<tr>"
    //                            + "<td>用户组：</td>"
    //                            + "<td><select id='select_group2'  onchange='groupchange(this,11);'  style='width:105px'>" + temp + "</select></td>"
    //                            + "<td>角 色：</td>"
    //                            + "<td><select id='select_js' style='width:105px'><option value='-11'>--请选择--</option><option value='1'>分公司</option><option value='0'>省公司</option></select></td>"
    //                            + "</tr>"
    //                            + "<tr>"
    //                            + "<td colspan=2>BS锁定：<input type='checkbox' id='chk_bslock' /></td>"
    //                            + "<td colspan=2>CS管理员：<input type='checkbox' id='chk_csmg' /></td>"
    //                            + "</tr>"
    //                            + "<tr style='text-align:center'>"
    //                            + "<td colspan='4'>"
    //                            + "<input type='button' value='添 加' onclick='adduser();' class='buttonface' style='width:60px' />&nbsp&nbsp&nbsp<input type='button' value='清 空' class='buttonface' onclick='clearuserinfo();' style='width:60px' />"
    //                            + "</td>"
    //                            + "</tr>"
    //                            + "</table>"


    //                            + "</div>"
    //                //查询用户
    //                            + "<div style='text-align:center;' onclick='changedivuser();' title='查询用户权限' id='div_style'>查询用户权限</div>"
    //                            + "<div  id='div_user_look' class='div_style_con2'>"


    //                            + "<table id='tab_user_look' style='width:100%;'>"
    //                            + "<tr>"
    //                            + "<td style='width:50px'>用户ID：</td>"
    //                            + "<td style='width:120px'><input type='text' style='width:80px' id='txt_userid1' /><input type='button' value='>>>' onclick='selectuser();' style='width:30px' /></td>"
    //                            + "<td><input type='button' value='查 询' onclick='showuserrightbyid();' style='width:42px' class='buttonface'>"
    //                            + "&nbsp<input type='button' value='删 除' onclick='deleteuser();' style='width:42px' class='buttonface'>"
    //                            + "&nbsp<input type='button' value='用户信息'  style='width:65px' onclick='ModifyUserById();' class='buttonface'></td>"
    //                            + "</tr>"
    //                            + "</table>"


    //                            + "</div>"
    //                            + "</div>"



    //                + "</div>";
    //            hr.Cells.Add(hc);
    //        }
    //        tab.Rows.Add(hr);
    //    }

    //}

    protected void Btn_group_modify_Click(object sender, EventArgs e)
    {
        string sql = " update tab_usergroup set qx_look ='" + Txt_look.Text + "',qx_update='" + Txt_update.Text
            + "',qx_insert ='" + Txt_insert.Text + "',qx_delete ='" + Txt_delete.Text + "' where groupname = '" + Txt_temp.Text + "' ";
        try
        {
            DbHelperSQL.ExecuteSql(sql);
            ToAlert("用户组修改成功！");
        }
        catch (Exception)
        {
            ToAlert("用户组修改出现异常，请联系管理员！");
        }
        ShowCity();
    }

    protected void Btn_group_delete_Click(object sender, EventArgs e)
    {
        string sql = " delete from tab_usergroup where groupname = '" + Txt_temp.Text + "' ";
        try
        {
            DbHelperSQL.ExecuteSql(sql);
            ToAlert("用户组\"" + Txt_temp.Text + "\"删除成功！");
        }
        catch (Exception)
        {
            ToAlert("用户组删除出现异常，请联系管理员！");
        }
        ShowCity();
    }

    /// <summary>
    /// 页面弹出对话框
    /// </summary>
    /// <param name="txt"></param>
    public void ToAlert(string txt)
    {
        this.Page.RegisterClientScriptBlock("", "<script>alert('" + txt + "');</script>");
    }

    protected void Btn_group_insert_Click(object sender, EventArgs e)
    {
        string sql = " insert into tab_usergroup(groupname) values('" + Txt_temp.Text + "') ";
        try
        {
            DbHelperSQL.ExecuteSql(sql);
            ToAlert("用户组\"" + Txt_temp.Text + "\"添加成功！");
        }
        catch (Exception)
        {
            ToAlert("用户组添加出现异常，请联系管理员！");
        }
        ShowCity();
    }
    protected void Btn_user_delete_Click(object sender, EventArgs e)
    {
        string sql = " delete from tab_yhxxb where yhbh = '" + Txt_temp.Text + "' ";
        string sql2 = " delete from tab_yhqxb where yhbh ='" + Txt_temp.Text + "' ";
        try
        {
            DbHelperSQL.ExecuteSql(sql);
            DbHelperSQL.ExecuteSql(sql2);
            ToAlert("用户ID\"" + Txt_temp.Text + "\"修改成功！");
        }
        catch (Exception)
        {
            ToAlert("用户修改出现异常，请联系管理员！");
        }
        ShowCity();
    }
    protected void Btn_user_add_Click(object sender, EventArgs e)
    {
        string sql = "";
        try
        {//用户ID-用户名-本地网-密码-用户组名-角色-bs锁定-cs管理员
            string[] arr = Txt_temp.Text.Split(';');

            sql = " insert into tab_yhxxb(yhbh,yhmc,sbdwyh,mm,groupname,yhjs,islock,is_cs_admin) values('"
                + arr[0] + "','"
                + arr[1] + "','"
                + arr[2] + "','"
                + arr[3] + "','"
                + arr[4] + "','"
                + arr[5] + "',"
                + arr[6] + ","
                + arr[7] + ") ";

            DbHelperSQL.ExecuteSql(sql);

            arr[5] = (arr[5].Equals("0") ? "SGS" : "FGS");

            sql = " insert into tab_yhqxb(yhbh,qxnr,qxlook,qxmod,qxadd,qxdelete) values('"
                + arr[0] + "','" + arr[5] + "','" + Txt_look.Text + "','" + Txt_update.Text + "','" + Txt_insert.Text + "','" + Txt_delete.Text + "') ";
            DbHelperSQL.ExecuteSql(sql);

            ToAlert("添加用户成功！");
        }
        catch (Exception)
        {
            ToAlert("添加用户出现异常，请联系管理员！");
        }
        ShowCity();
    }
}
